/*******************
Figure 1. States with an EITC and Metropolitan Areas with Uber Operating in the Area
*******************/
use "data\uber_entry_dates", clear

collapse (sum) start_uber, by(year)

gen e = 11 if year == 2010
expand e
bys year: gen n = _n-1
replace year = year-n
sort year

replace start_uber = 0 if year<2010
drop e n
gen have_uber = sum(start_uber)

tempfile yr_msa 
save `yr_msa'

use "data\state_eitc_panel", clear

collapse (max) have_eitc, by(stfips year) 

collapse (sum) have_eitc, by(year)

merge 1:1 year using `yr_msa'

twoway (line have_uber year if year<=2019, lcolor(black) lpattern(__) lwidth(*1.5) yaxis(1)) ///
	(line have_eitc year if year>=2000 & year<=2019, lcolor(navy) lwidth(*1.5) yaxis(2)) ///
	, legend(order(1 "MSA with Uber" 2 "States with EITC") rows(1) pos(6)) graphregion(color(white)) xtitle(Year) xlabel(2000(2)2018) ///
	ytitle("Number of States with EITC", axis(2)) ytitle("Number of MSA with Uber", axis(1)) ///
	ylabel(12(4)28, axis(2)) ylabel(0(50)250, axis(1))
	
graph export "output\trend_eitc_wuber.pdf", replace